package com.dy.pojo.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: 博客实体类
 * @Date: 2021/6/1 10:06
 * @Version 1.0 (版本)
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@TableName("dy_blog")
public class DyBlogEntity implements Serializable {
    /**
     * @JsonFormat(shape = JsonFormat.Shape.STRING)【解决雪花算法精度丢失，提前转为String类型，可以代替下面的】
     * id
     */
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    //@JSONField(serializeUsing = ToStringSerializer.class)
    private Long id;
    /**
     * 标题
     */
    @TableField(value = "title")
    private String title;
    /**
     * 编码
     */
    @TableField(value = "code")
    private String code;
    /**
     * 用户编码
     */
    @TableField(value = "user_code")
    private String userCode;
    /**
     * 分类编码
     */
    @TableField(value = "type_code")
    private String typeCode;

    /**
     * 内容
     */
    @TableField(value = "content")
    private String content;
    /**
     * 首图
     */
    @TableField(value = "firstPicture")
    private String firstPicture;
    /**
     * 标记
     */
    @TableField(value = "flag")
    private String flag;
    /**
     * 浏览次数
     */
    @TableField(value = "views")
    private Integer views;
    /**
     * 赞赏
     */
    @TableField(value = "appreciation")
    private Boolean appreciation;
    /**
     *转载声明
     */
    @TableField(value = "shareStatement")
    private Boolean shareStatement;
    /**
     * 评论
     */
    @TableField(value = "commentabled")
    private Boolean commentabled;
    /**
     * 发布
     */
    @TableField(value = "published")
    private Boolean published;
    /**
     * 推荐
     */
    @TableField(value = "recommend")
    private Boolean recommend;
    /**
     * 描述
     */
    @TableField(value = "description")
    private String description;
    /**
     * 删除标记
     */
    @TableField(value = "deleted",fill = FieldFill.INSERT)
    @TableLogic(value = "0",delval = "1")
    private Integer deleted;
    /**
     * 乐观锁
     */
    @TableField(value = "rowVersion",fill = FieldFill.INSERT)
    @Version
    private Integer rowVersion;
    /**
     * 创建时间
     */
    @TableField(value = "createTime",fill = FieldFill.INSERT)
    private Timestamp createTime;
    /**
     * 更新时间
     */
    @TableField(value = "updateTime",fill = FieldFill.INSERT_UPDATE)
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Timestamp updateTime;
}
